package com.onlinewebgames.memory;

import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.widget.Button;
import android.widget.ImageView;

public abstract class Util {

	/**
	 * @param boton
	 * @param srcColor
	 *            por ejemplo Color.GREEN
	 */
	public static void cambiarFondoBoton (Button boton, int srcColor) {
		final Drawable d = boton.getBackground();
		final PorterDuffColorFilter filter = new PorterDuffColorFilter(
				Color.GREEN, PorterDuff.Mode.SRC_ATOP);
		d.setColorFilter(filter);
	}

	public static void animate (ImageView boton, int animacion) {
		boton.setVisibility(ImageView.VISIBLE);
		boton.setBackgroundResource(animacion);

		AnimationDrawable frame = (AnimationDrawable) boton.getBackground();

		frame.start();

	}
}
